package com.liucxu.qiushimeinv.Base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.afollestad.materialdialogs.MaterialDialog;

/**
 * Activity基础类
 * Created by liucxu on 2017/1/1.
 */

public abstract class BaseActivity extends AppCompatActivity {

    public MaterialDialog dialog;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initBeforeView();
        setContentView(getInflateLayout());
        setupView();
        setupData();
        dialog=new MaterialDialog.Builder(this).build();
    }

    /**
     * setContentView 方法之前需要做一些事情的地方
     */
    public abstract void initBeforeView();

    public abstract int getInflateLayout();

    public abstract void setupView();

    public abstract void setupData();

    public <T extends View> T $(int id) {
        return (T)findViewById(id);
    }
}
